// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
const
Hud_element = 1@
Hud_element1 = 2@
PositionY = 30@
CURRENT_TOWN = 16@
ZONE_TEXT         = s$93 
TOWN_TEXT         = s$95
end         
                      
0000:
 
if
8AAB:   not file_exists "MODELS\TXD\sm2018.TXD" 
else_jump @HUD_150 
0A93: end_custom_thread 

:HUD_150
0ADF: add_dynamic_GXT_entry "MAXI" text "Edited by Maxirp93"
0ADF: add_dynamic_GXT_entry "DEAD" text "" 
0ADF: add_dynamic_GXT_entry "WAST" text "WASTED!" 
0ADF: add_dynamic_GXT_entry "BUSTED" text "" 
0ADF: add_dynamic_GXT_entry "BUST" text "BUSTED!" 
gosub @HUD_7329 

:HUD_944
wait 0 
gosub @HUD_1121 
gosub @HUD_1176 
gosub @HUD_1225 
if or
08B7:   test 15@ bit 0 
08B7:   test 15@ bit 1 
88B7:   not test 15@ bit 2 
else_jump @HUD_1019 
jump @HUD_1114 

:HUD_1019
03F0: enable_text_draw 1
if
88FE:   not text_box_displayed
then 
if
    0AB1: @Should_display_oxygen_bar 0
then
    PositionY = 70.0
    0AB1: Calc @oxygen_level 0 Hud_element
    gosub @Display_hud_element
end
PositionY = 70.0              
0AB1: Calc @health_level 0 Hud_element Hud_element1
gosub @Display_hud_element
gosub @Display_status_number
if
    0AB1: @Should_display_kevlar_bar 0
then
    PositionY = 70.0
    0AB1: Calc @Kevlar_level 0 Hud_element
    gosub @Display_hud_element
end
end
gosub @Display_watermark
gosub @HUD_7160 //dead 
gosub @HUD_7244 //busted
jump @HUD_1114

:HUD_1114
jump @HUD_944
jump @HUD_944
jump @HUD_944 

:HUD_1121
0A8D: 0@ = read_memory 11989093 size 1 virtual_protect 0 
if 
  0@ == 1 
else_jump @HUD_1167 
08BD: set 15@ bit 0 
jump @HUD_1174 

:HUD_1167
08C3: clear 15@ bit 0 

:HUD_1174
return 

:HUD_1176
if 
06B9:   cutscene_data_loaded 
else_jump @HUD_1216 
if 
82E9:   not cutscene_reached_end 
else_jump @HUD_1209 
08BD: set 15@ bit 1 

:HUD_1209
jump @HUD_1223 

:HUD_1216
08C3: clear 15@ bit 1 

:HUD_1223
return 

:HUD_1225
0A8D: 0@ = read_memory 12216169 size 1 virtual_protect 0 
if 
  0@ == 0 
else_jump @HUD_1271 
08C3: clear 15@ bit 2 
jump @HUD_1278 

:HUD_1271
08BD: set 15@ bit 2 

:HUD_1278
return 

:Should_display_oxygen_bar
if 
0965:   actor $PLAYER_ACTOR swimming 
else_jump @Should_display_oxygen_bar_2
jump @Should_display_oxygen_bar_3

:Should_display_oxygen_bar_2
if 
   Actor.Driving($PLAYER_ACTOR)
jf @Should_display_oxygen_bar_4
31@ = Actor.CurrentCar($PLAYER_ACTOR)
if and
   Car.Wrecked(31@)
02BF:   car 31@ sunk
jf @Should_display_oxygen_bar_4

:Should_display_oxygen_bar_3
0485:  return_true
jump @Should_display_oxygen_bar_5

:Should_display_oxygen_bar_4
059A:  return_false

:Should_display_oxygen_bar_5
0AB2: ret 0

:Should_display_kevlar_bar
04DD: 30@ = actor $PLAYER_ACTOR armour
if
30@ > 0
else_jump @Should_display_kevlar_bar_4
jump @Should_display_kevlar_bar_3

:Should_display_kevlar_bar_3
0485:  return_true
jump @Should_display_kevlar_bar_5

:Should_display_kevlar_bar_4
059A:  return_false

:Should_display_kevlar_bar_5
0AB2: ret 0

:oxygen_level
gosub @oxygen_level_3 
gosub @oxygen_level_4
0AB1: @Get_texture_id 5 0@ 74 4 20 96 4@
jump @oxygen_level_2

:oxygen_level_2
0AB2: ret 1 4@

:oxygen_level_3
0653: 1@ = float_stat 225 // lung capacity stat
1@ *= 1.5 
1@ += 1000.0
0653: 3@ = float_stat 22 // stamina stat
3@ *= 1.5
005B: 1@ += 3@ // (float)  
return 

:oxygen_level_4
0@ = 0
0652: 2@ = integer_stat 4080 //oxygen level 
if
  2@ > 0 
else_jump @oxygen_level_5
0@ = 100.0 
if 
0025:   1@ > 2@ // (float) 
else_jump @oxygen_level_5 
0073: 1@ /= 2@ // (float) 
0073: 0@ /= 1@ // (float) 
0087: 2@ = 0@ // (float) 

:oxygen_level_5
0092: 0@ = float 0@ to_integer 
return 

:Health_level
gosub @Health_level_1
0AB1: @Get_texture_id 5 29@ 34 2 33 99 4@
0AB2: ret 2 4@ 29@

:Health_level_1
29@ = Actor.Health($PLAYER_ACTOR)
0093: 29@ = integer 29@ to_float 
0653: 3@ = float_stat 24 
3@ /= 5.69 
0073: 29@ /= 3@ // (float)
29@ *= 100.0
0092: 29@ = float 29@ to_integer 
0092: 3@ = float 3@ to_integer
return

:Kevlar_level
gosub @Kevlar_level_1
0AB1: @Get_texture_id 5 30@ 54 4 20 96 4@
0AB2: ret 1 4@

:Kevlar_level_1
04DD: 30@ = actor $PLAYER_ACTOR armour 
0945: get_player 0 max_armour_to 31@ 
0093: 30@ = integer 30@ to_float 
0093: 31@ = integer 31@ to_float 
0073: 30@ /= 31@ // (float)
30@ *= 100.0
0092: 30@ = float 30@ to_integer 
0092: 31@ = float 31@ to_integer
return 

:Display_hud_element
//Calculate size on screen
0AB1: call_scm_func @Proportional_size_x 1 500.0 18@
0AB1: call_scm_func @Proportional_size_y 1 250.0 19@
//Calculate position on screen
0AB1: call_scm_func @Proportional_size_x 1 250.0 16@
0AB1: call_scm_func @Proportional_size_y 1 125.0 17@
03E3: set_texture_to_be_drawn_antialiased 1                                        
038D: draw_texture Hud_element position 16@ 17@ size 18@ 19@ RGBA 255 255 255 255
return

:Display_status_number
03E0: unknown_text_draw_flag 1 
0349: set_text_draw_font 2 
0348: enable_text_draw_proportional 1 
081C: draw_text_outline 0 RGBA 0 0 0 0
0341: set_text_draw_align_justify 0 
03E4: set_text_draw_align_right 1 
0340: set_text_draw_RGBA 255 255 255 255
0AB1: call_scm_func @Proportional_size_x 1 0.5 18@
0AB1: call_scm_func @Proportional_size_y 1 3.0 19@ 
033F: set_text_draw_letter_size 18@ 19@
0AB1: call_scm_func @Proportional_size_x 1 460.0 16@
0AB1: call_scm_func @Proportional_size_y 1 60.0 17@
045A: draw_text_1number 16@ 17@ GXT "NUMBER" number Hud_element1 
return

:Display_watermark
03E0: unknown_text_draw_flag 1 
0349: set_text_draw_font 2 
0348: enable_text_draw_proportional 1 
081C: draw_text_outline 0 RGBA 0 0 0 0
0341: set_text_draw_align_justify 0 
03E4: set_text_draw_align_right 1 
0340: set_text_draw_RGBA 255 255 255 100
033F: set_text_draw_letter_size 0.145 0.75
033E: set_draw_text_position 635.0 10.0 GXT "MAXI" 
return

:HUD_7160
if 
   Player.Wasted(0)
else_jump @HUD_7242 
03E0: draw_text_behind_textures 1 
033F: set_text_draw_letter_size 1.3 6.3 
060D: draw_text_shadow 3 rgba 0 0 0 255 
0340: set_text_draw_RGBA 10 185 115 230 
0342: set_text_draw_centered 1 
0349: set_text_draw_font 3 
033E: set_draw_text_position 330.0 125.0 GXT "WAST" 

:HUD_7242
return 

:HUD_7244
if 
0741:   actor $PLAYER_ACTOR busted 
else_jump @HUD_7327 
03E0: draw_text_behind_textures 1 
033F: set_text_draw_letter_size 1.3 6.3 
060D: draw_text_shadow 3 rgba 0 0 0 255 
0340: set_text_draw_RGBA 10 185 115 230 
0342: set_text_draw_centered 1 
0349: set_text_draw_font 3 
033E: set_draw_text_position 330.0 125.0 GXT "BUST" 

:HUD_7327
return 

:HUD_7329
0391: release_textures 
0390: load_txd_dictionary "sm2018" 
038F: load_texture "0" as 1 // Load dictionary with 0390 first 
038F: load_texture "1" as 2 // Load dictionary with 0390 first 
038F: load_texture "2" as 3 // Load dictionary with 0390 first 
038F: load_texture "3" as 4 // Load dictionary with 0390 first 
038F: load_texture "4" as 5 // Load dictionary with 0390 first 
038F: load_texture "5" as 6 // Load dictionary with 0390 first 
038F: load_texture "6" as 7 // Load dictionary with 0390 first 
038F: load_texture "7" as 8 // Load dictionary with 0390 first 
038F: load_texture "8" as 9 // Load dictionary with 0390 first 
038F: load_texture "9" as 10 // Load dictionary with 0390 first 
038F: load_texture "10" as 11 // Load dictionary with 0390 first 
038F: load_texture "11" as 12 // Load dictionary with 0390 first 
038F: load_texture "12" as 13 // Load dictionary with 0390 first 
038F: load_texture "13" as 14 // Load dictionary with 0390 first 
038F: load_texture "14" as 15 // Load dictionary with 0390 first 
038F: load_texture "15" as 16 // Load dictionary with 0390 first 
038F: load_texture "16" as 17 // Load dictionary with 0390 first 
038F: load_texture "17" as 18 // Load dictionary with 0390 first 
038F: load_texture "18" as 19 // Load dictionary with 0390 first 
038F: load_texture "19" as 20 // Load dictionary with 0390 first 
038F: load_texture "20" as 21 // Load dictionary with 0390 first 
038F: load_texture "21" as 22 // Load dictionary with 0390 first 
038F: load_texture "22" as 23 // Load dictionary with 0390 first 
038F: load_texture "23" as 24 // Load dictionary with 0390 first 
038F: load_texture "24" as 25 // Load dictionary with 0390 first 
038F: load_texture "25" as 26 // Load dictionary with 0390 first 
038F: load_texture "26" as 27 // Load dictionary with 0390 first 
038F: load_texture "27" as 28 // Load dictionary with 0390 first 
038F: load_texture "28" as 29 // Load dictionary with 0390 first 
038F: load_texture "29" as 30 // Load dictionary with 0390 first 
038F: load_texture "30" as 31 // Load dictionary with 0390 first
038F: load_texture "30a" as 32 // Load dictionary with 0390 first 
038F: load_texture "30b" as 33 // Load dictionary with 0390 first 
038F: load_texture "30c" as 34 // Load dictionary with 0390 first 
038F: load_texture "31" as 35 // Load dictionary with 0390 first 
038F: load_texture "32" as 36 // Load dictionary with 0390 first 
038F: load_texture "33" as 37 // Load dictionary with 0390 first 
038F: load_texture "34" as 38 // Load dictionary with 0390 first 
038F: load_texture "35" as 39 // Load dictionary with 0390 first 
038F: load_texture "36" as 40 // Load dictionary with 0390 first 
038F: load_texture "37" as 41 // Load dictionary with 0390 first 
038F: load_texture "38" as 42 // Load dictionary with 0390 first 
038F: load_texture "39" as 43 // Load dictionary with 0390 first 
038F: load_texture "40" as 44 // Load dictionary with 0390 first 
038F: load_texture "41" as 45 // Load dictionary with 0390 first 
038F: load_texture "42" as 46 // Load dictionary with 0390 first 
038F: load_texture "43" as 47 // Load dictionary with 0390 first 
038F: load_texture "44" as 48 // Load dictionary with 0390 first 
038F: load_texture "45" as 49 // Load dictionary with 0390 first 
038F: load_texture "46" as 50 // Load dictionary with 0390 first 
038F: load_texture "47" as 51 // Load dictionary with 0390 first 
038F: load_texture "48" as 52 // Load dictionary with 0390 first 
038F: load_texture "49" as 53 // Load dictionary with 0390 first 
038F: load_texture "50" as 54 // Load dictionary with 0390 first 
038F: load_texture "51" as 55 // Load dictionary with 0390 first 
038F: load_texture "52" as 56 // Load dictionary with 0390 first 
038F: load_texture "53" as 57 // Load dictionary with 0390 first 
038F: load_texture "54" as 58 // Load dictionary with 0390 first 
038F: load_texture "55" as 59 // Load dictionary with 0390 first 
038F: load_texture "56" as 60 // Load dictionary with 0390 first 
038F: load_texture "57" as 61 // Load dictionary with 0390 first 
038F: load_texture "58" as 62 // Load dictionary with 0390 first 
038F: load_texture "59" as 63 // Load dictionary with 0390 first 
038F: load_texture "60" as 64 // Load dictionary with 0390 first 
038F: load_texture "61" as 65 // Load dictionary with 0390 first 
038F: load_texture "62" as 66 // Load dictionary with 0390 first 
038F: load_texture "63" as 67 // Load dictionary with 0390 first 
038F: load_texture "64" as 68 // Load dictionary with 0390 first 
038F: load_texture "65" as 69 // Load dictionary with 0390 first 
038F: load_texture "66" as 70 // Load dictionary with 0390 first 
038F: load_texture "67" as 71 // Load dictionary with 0390 first 
038F: load_texture "68" as 72 // Load dictionary with 0390 first 
038F: load_texture "69" as 73 // Load dictionary with 0390 first 
038F: load_texture "70" as 74 // Load dictionary with 0390 first
return 

:IsRadarOnScreen
0A8D: 1@ = read_memory 0xBA676C size 4 virtual_protect 0 
0A8D: 2@ = read_memory 0xBAA3FB size 4 virtual_protect 0 
if  and
    1@ == 2 
    2@ == 0 
then
    059A:  return_false
else
    0485:  return_true
end
0AB2: ret 0

:Proportional_size_x
0A8D: 1@ = read_memory 12677188 size 4 virtual_protect 0 
0093: 1@ = integer 1@ to_float
0@ *= 640.0
0073: 0@ /= 1@ // (float)
0AB2: ret 1 0@

:Proportional_size_y
0A8D: 2@ = read_memory 12677192 size 4 virtual_protect 0 
0093: 2@ = integer 2@ to_float
0@ *= 448.0
0073: 0@ /= 2@ // (float)
0AB2: ret 1 0@

:Position_x
0A8D: 1@ = read_memory 12677188 size 4 virtual_protect 0 
0093: 1@ = integer 1@ to_float
0@ *= 640.0
0073: 0@ /= 1@ // (float)
0AB2: ret 1 0@

:Position_y
0A8D: 2@ = read_memory 12677192 size 4 virtual_protect 0 
0093: 2@ = integer 2@ to_float
0@ *= 448.0
0073: 0@ /= 2@ // (float)
0AB2: ret 1 0@

:IsInInterior
077E: get_active_interior_to 0@ 
if 
    0@ == 0 
then
    059A:  return_false
else
    0485:  return_true
end
0AB2: ret 0                   

:Get_texture_id

if 
  0@ > 100 
else_jump @Get_texture_id_1449 
goto @Get_texture_id_2280 

:Get_texture_id_1449
if 
002D: 0@ > 4@ 
else_jump @Get_texture_id_1507 
jump @Get_texture_id_2280

:Get_texture_id_1507
0085: 5@ = 4@
5@ -= 1

:Get_texture_id_1510
if
   0@ > 0
jf @Get_texture_id_2222 
if
   002D: 5@ >= 0@
then
    0062: 5@ -= 2@ 
    if
        002D: 0@ >= 5@
    then                                              
        goto @Get_texture_id_2280
    else
        5@ -= 1
        1@ -= 1
        goto @Get_texture_id_1510
    end
else
    0062: 5@ -= 2@
    5@ -= 1
    1@ -= 1
end

:Get_texture_id_2222
if 
  0@ == 0 
else_jump @Get_texture_id_2280 
0062: 1@ -= 3@ 

:Get_texture_id_2280
0AB2: ret 1 1@